package com.compy.svwtt;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class TeamsActivity extends ListActivity {
		
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1, this.getResources().getStringArray(R.array.MannschaftenArr)));
    }
    
    protected void onListItemClick(ListView lv, View v, int position, long id) {
        String openClass = "MannschaftActivity";
             
        try {
        	Class selected = Class.forName("com.compy.svwtt." + openClass);
        	Intent selectedIntent = new Intent(this, selected);
        	selectedIntent.putExtra("Mannschaft",  this.getResources().getStringArray(R.array.MannschaftenArr)[position]);
        	startActivity(selectedIntent);
        } catch (ClassNotFoundException e){
        	e.printStackTrace();
        }   	
    }
        
}